Other Constants

The following constants are available globally.

  • An NSNumber object containing a Boolean enabling or disabling clustering. If the features property contains point features, setting this option to YES clusters the points by radius into groups. The default value is NO.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLGeoJSONClusterOption

    Swift

    let MGLGeoJSONClusterOption: String
  • An NSNumber object containing an integer; specifies the radius of each cluster if clustering is enabled. A value of 512 produces a radius equal to the width of a tile. The default value is 50.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLGeoJSONClusterRadiusOption

    Swift

    let MGLGeoJSONClusterRadiusOption: String
  • An NSNumber object containing an integer; specifies the maximum zoom level at which to cluster points if clustering is enabled. Defaults to one zoom level less than the value of MGLGeoJSONMaximumZoomLevelOption so that, at the maximum zoom level, the features are not clustered.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLGeoJSONClusterMaximumZoomLevelOption

    Swift

    let MGLGeoJSONClusterMaximumZoomLevelOption: String
  • An NSNumber object containing an integer; specifies the maximum zoom level at which to create vector tiles. A greater value produces greater detail at high zoom levels. The default value is 18.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLGeoJSONMaximumZoomLevelOption

    Swift

    let MGLGeoJSONMaximumZoomLevelOption: String
  • An NSNumber object containing an integer; specifies the size of the tile buffer on each side. A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance. The default value is 128.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLGeoJSONBufferOption

    Swift

    let MGLGeoJSONBufferOption: String
  • An NSNumber object containing a double; specifies the Douglas-Peucker simplification tolerance. A greater value produces simpler geometries and improves performance. The default value is 0.375.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLGeoJSONToleranceOption

    Swift

    let MGLGeoJSONToleranceOption: String
  • Posted by the shared MGLOfflineStorage object when an MGLOfflinePack object’s progress changes. The progress may change due to a resource being downloaded or because the pack discovers during the download that more resources are required for offline viewing. This notification is posted whenever any field in the progress property changes.

    The object is the MGLOfflinePack object whose progress changed. The userInfo dictionary contains the pack’s current state in the MGLOfflinePackStateUserInfoKey key and details about the pack’s current progress in the MGLOfflinePackProgressUserInfoKey key. You may also consult the pack’s state and progress properties, which provide the same values.

    If you only need to observe changes in a particular pack’s progress, you can alternatively observe KVO change notifications to the pack’s progress key path.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLOfflinePackProgressChangedNotification

    Swift

    static let MGLOfflinePackProgressChanged: NSNotification.Name
  • Posted by the shared MGLOfflineStorage object whenever an MGLOfflinePack object encounters an error while downloading. The error may be recoverable and may not warrant the user’s attention. For example, the pack’s implementation may attempt to re-request failed resources based on an exponential backoff strategy or upon the restoration of network access.

    The object is the MGLOfflinePack object that encountered the error. The userInfo dictionary contains the error object in the MGLOfflinePackErrorUserInfoKey key.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLOfflinePackErrorNotification

    Swift

    static let MGLOfflinePackError: NSNotification.Name
  • Posted by the shared MGLOfflineStorage object when the maximum number of Mapbox-hosted tiles has been downloaded and stored on the current device.

    The object is the MGLOfflinePack object that reached the tile limit in the course of downloading. The userInfo dictionary contains the tile limit in the MGLOfflinePackMaximumCountUserInfoKey key.

    Once this limit is reached, no instance of MGLOfflinePack can download additional tiles from Mapbox APIs until already downloaded tiles are removed by calling the -[MGLOfflineStorage removePack:withCompletionHandler:] method. Contact your Mapbox sales representative to have the limit raised.

    Declaration

    Objective-C

    extern NSString
        *const _Nonnull MGLOfflinePackMaximumMapboxTilesReachedNotification

    Swift

    static let MGLOfflinePackMaximumMapboxTilesReached: NSNotification.Name
  • The key for an NSNumber object that indicates an offline pack’s current state. This key is used in the userInfo dictionary of an MGLOfflinePackProgressChangedNotification notification. Call -integerValue on the object to receive the MGLOfflinePackState-typed state.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLOfflinePackStateUserInfoKey

    Swift

    let MGLOfflinePackStateUserInfoKey: String
  • The key for an NSValue object that indicates an offline pack’s current progress. This key is used in the userInfo dictionary of an MGLOfflinePackProgressChangedNotification notification. Call -MGLOfflinePackProgressValue on the object to receive the MGLOfflinePackProgress-typed progress.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLOfflinePackProgressUserInfoKey

    Swift

    let MGLOfflinePackProgressUserInfoKey: String
  • The key for an NSError object that is encountered in the course of downloading an offline pack. This key is used in the userInfo dictionary of an MGLOfflinePackErrorNotification notification. The error’s domain is MGLErrorDomain. See MGLErrorCode for possible error codes.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLOfflinePackErrorUserInfoKey

    Swift

    let MGLOfflinePackErrorUserInfoKey: String
  • The key for an NSNumber object that indicates the maximum number of Mapbox-hosted tiles that may be downloaded and stored on the current device. This key is used in the userInfo dictionary of an MGLOfflinePackMaximumMapboxTilesReachedNotification notification. Call -unsignedLongLongValue on the object to receive the uint64_t-typed tile limit.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLOfflinePackMaximumCountUserInfoKey

    Swift

    let MGLOfflinePackMaximumCountUserInfoKey: String
  • A version number identifying the default version of the suite of default styles provided by Mapbox. This version number may be passed into one of the “StyleURLWithVersion” class methods of MGLStyle.

    The value of this constant generally corresponds to the latest released version as of the date on which this SDK was published. You can use this constant to ascertain the style used by MGLMapView and MGLTilePyramidOfflineRegion when no style URL is specified. Consult the Mapbox Styles API documentation for the most up-to-date style versioning information.

    Warning

    The value of this constant may change in a future release of the SDK. If you use any feature that depends on a specific aspect of a default style – for instance, the minimum zoom level that includes roads – you may use the current value of this constant or the underlying style URL, but do not use the constant itself. Such details may change significantly from version to version.

    Declaration

    Objective-C

    static const NSInteger MGLStyleDefaultVersion = 9

    Swift

    let MGLStyleDefaultVersion: Int
  • Indicates an error occurred in the Mapbox SDK.

    Declaration

    Objective-C

    extern NSString *const _Nonnull MGLErrorDomain

    Swift

    let MGLErrorDomain: String